/*
 * @Author: lzn
 * @Date: 2022-09-19 19:14:13
 * @LastEditTime: 2022-10-20 10:55:17
 * @Description: 路由组件
 */
import TextBox from './components/TextBox/index.vue';
import Menu from './components/Menu/demo.vue';
import TextInput from './components/TextInput/index.vue';
import Textarea from './components/Textarea/index.vue';
import Password from './components/Password/index.vue';
import Number from './components/Number/index.vue';
import SvgIcon from './components/SvgIcon/index.vue';
import Heading from './components/Heading/index.vue';
import Image from './components/Image/index.vue';
import Avatar from './components/Avatar/index.vue';
import Switch from "./components/Switch/index.vue";
import Radio from "./components/Radio/index.vue";
import RadioGroup from "./components/RadioGroup/index.vue";
import Button from "./components/Button/index.vue";
import ButtonGroup from "./components/ButtonGroup/index.vue";
import DatePicker from './components/DatePicker/index.vue'
import TimePicker from "./components/TimePicker/index.vue";
import DateRangePicker from "./components/DateRangePicker/index.vue";
import DateTimePicker from "./components/DateTimePicker/index.vue";
import TimeRangePicker from "./components/TimeRangePicker/index.vue";
import DateTimeRangePicker from "./components/DateTimeRangePicker/index.vue";
import Select from "./components/Select/index.vue";
import MonthPicker from "./components/MonthPicker/index.vue";
import WeekPicker from "./components/WeekPicker/index.vue";
import YearPicker from "./components/YearPicker/index.vue";
import Cascader from "./components/Cascader/index.vue";
import Slider from './components/Slider/index.vue';
import Progress from './components/Progress/index.vue';
import CircleProgress from './components/CircleProgress/index.vue';
import GaugeProgress from './components/GaugeProgress/index.vue';
import Range from './components/Range/index.vue';
import HorizontalTimeLine from './components/HorizontalTimeLine/index.vue';
import VerticalTimeLine from './components/VerticalTimeLine/index.vue';
import HorizontalDivider from './components/HorizontalDivider/index.vue';
import VerticalDivider from './components/VerticalDivider/index.vue';
import RadioButton from "./components/RadioButton/index.vue";
import RadioButtonGroup from "./components/RadioButtonGroup/index.vue";
import Checkbox from "./components/Checkbox/index.vue";
import CheckboxGroup from "./components/CheckboxGroup/index.vue";
import CheckButton from "./components/CheckButton/index.vue";
import CheckButtonGroup from "./components/CheckButtonGroup/index.vue";
import List from './components/List/index.vue';
import OrderList from './components/OrderList/index.vue';
import Tag from './components/Tag/demo.vue';
import Badge from './components/Badge/index.vue';
import BadgeTag from './components/BadgeTag/index.vue';
import Skeleton from './components/Skeleton/index.vue';
import Empty from "./components/Empty/index.vue";
import Tree from "./components/Tree/index.vue";
import Card from "./components/Card/index.vue";
import OptionList from "./components/OptionList/index.vue";
import ObjectList from "./components/ObjectList/index.vue";
import EditableList from "./components/EditableList/index.vue";
import Layout from "./components/Layout/index.vue";
import Dropdown from "./components/Dropdown/index.vue";
import DropdownItem from "./components/DropdownItem/index.vue";
import CardList from "./components/CardList/index.vue";
import CardTree from "./components/CardTree/index.vue";
import EditableTree from "./components/EditableTree/index.vue";
import EditableCardList from "./components/EditableCardList/index.vue";
import TreeChart from "./charts/TreeChart/index.vue";
import Table from "./components/Table/index.vue";
import EditableTable from "./components/EditableTable/index.vue";
import FeatureTag from "./components/FeatureTag/index.vue";
import CheckableTag from "./components/CheckableTag/index.vue";
import CheckableTagGroup from "./components/CheckableTagGroup/index.vue";
import ClosableTag from "./components/ClosableTag/index.vue";
import EditableTag from './components/EditableTag/index.vue';
import Descrptions from './components/Descrptions/index.vue';
import FeatureTextInput from "./components/FeatureTextInput/index.vue";
import TextareaInput from "./components/TextareaInput/index.vue";
import PasswordInput from "./components/PasswordInput/index.vue";
import NumberInput from "./components/NumberInput/index.vue";
import FeatureDatePicker from "./components/FeatureDatePicker/index.vue";
import ColorPicker from "./components/ColorPicker/index.vue";
import Calendar from "./components/Calendar/index.vue";
import Form from './components/Form/index.vue';
import FeatureSlider from "./components/FeatureSlider/index.vue";
import RangeInput from "./components/RangeInput/index.vue";
import Comment from "./components/Comment/index.vue";
import Row from './components/Row/index.vue';
import CollapsePanel from './components/CollapsePanel/index.vue';
import FeatureTimePicker from "./components/FeatureTimePicker/index.vue";
import FeatureDateRangePicker from "./components/FeatureDateRangePicker/index.vue";
import FeatureTimeRangePicker from "./components/FeatureTimeRangePicker/index.vue";
import FeatureMonthPicker from "./components/FeatureMonthPicker/index.vue";
import FeatureYearPicker from "./components/FeatureYearPicker/index.vue";
import PropertyPanel from './components/PropertyPanel/index.vue';
import EditPanel from './components/EditPanel/index.vue';
import MeasureInput from "./components/MeasureInput/index.vue";
import FeatureSwitch from "./components/FeatureSwitch/index.vue";
import FeatureRadio from "./components/FeatureRadio/index.vue";
import FeatureRadioGroup from "./components/FeatureRadioGroup/index.vue";
import FeatureRadioButton from "./components/FeatureRadioButton/index.vue";
import FeatureRadioButtonGroup from "./components/FeatureRadioButtonGroup/index.vue";
import FeatureCheckbox from "./components/FeatureCheckbox/index.vue";
import FeatureCheckButton from "./components/FeatureCheckButton/index.vue";
import FeatureCheckButtonGroup from "./components/FeatureCheckButtonGroup/index.vue";
import PropertySetting from './components/PropertySetting/index.vue';
import FeatureList from './components/FeatureList/index.vue';
import FeatureOptionList from './components/FeatureOptionList/index.vue';
import Container from './components/Container/index.vue';
import GroupPanel from './components/GroupPanel/index.vue';
import Tabs from './components/Tabs/index.vue';
import ModalDialog from './components/ModalDialog/index.vue';
import Drawer from './components/Drawer/demo.vue';
import Popover from './components/Popover/index.vue';
import PopConfirm from './components/PopConfirm/index.vue';
import FeatureWeekPicker from "./components/FeatureWeekPicker/index.vue";
import FeatureSelect from "./components/FeatureSelect/index.vue";
import FeatureCascader from "./components/FeatureCascader/index.vue";
import FeatureDateTimePicker from "./components/FeatureDateTimePicker/index.vue";
import Segmented from "./components/Segmented/index.vue";
import Breadcrumb from "./components/Breadcrumb/index.vue";
import Steps from "./components/Steps/index.vue";
import PageHeader from "./components/PageHeader/index.vue";
import SimplePagination from "./components/SimplePagination/index.vue";
import Pagination from "./components/Pagination/index.vue";
import OptionTransfer from "./components/OptionTransfer/index.vue";
import ListTransfer from "./components/ListTransfer/index.vue";
import TableTransfer from "./components/TableTransfer/index.vue";
import TreeTransfer from "./components/TreeTransfer/index.vue";
import PieChart from "./components/PieChart/index.vue";
import BackTop from "./components/BackTop/index.vue";
import Affix from "./components/Affix/index.vue";
import Anchor from "./components/Anchor/index.vue";
import Tooltip from "./components/Tooltip/index.vue";
import Alert from "./components/Alert/index.vue";
import Message from "./components/Message/index.vue";
import Notification from "./components/Notification/index.vue";
import Result from "./components/Result/index.vue";
import Loading from "./components/Loading/index.vue";
import FeatureTable from "./components/FeatureTable/index.vue";
import FeatureEditableTable from "./components/FeatureEditableTable/index.vue";
import Statistic from "./components/Statistic/index.vue";
import SecondCountdown from "./components/SecondCountdown/index.vue";
import MinuteCountdown from "./components/MinuteCountdown/index.vue";
import MillisecondCountdown from "./components/MillisecondCountdown/index.vue";

const routes = [
  { path: '/', redirect: '/text-box' },
  { path: '/base-layout', title: '基础布局', component: Layout },
  { path: '/base-text-box', title: '基础文本显示框', component: TextBox },
  { path: '/base-menu', title: '基础菜单', component: Menu },
  { path: '/base-text-input', title: '基础文本输入框', component: TextInput },
  { path: '/base-textarea', title: '基础文本域输入框', component: Textarea },
  { path: '/base-password', title: '基础密码输入框', component: Password },
  { path: '/base-number', title: '基础数值输入框', component: Number },
  { path: '/base-svg-icon', title: '基础图标', component: SvgIcon },
  { path: '/base-heading', title: '基础标题', component: Heading },
  { path: '/base-img', title: '基础图片', component: Image },
  { path: '/base-avatar', title: '基础头像', component: Avatar },
  { path: '/base-button', title: '基础按钮', component: Button },
  { path: '/base-button-group', title: '基础按钮组', component: ButtonGroup },
  { path: '/base-switch', title: '基础开关', component: Switch },
  { path: '/base-radio', title: '基础单选框', component: Radio },
  { path: '/base-radio-group', title: '基础单选框组', component: RadioGroup },
  { path: '/base-slider', title: '基础滑动输入框', component: Slider },
  { path: '/base-progress', title: '基础进度条', component: Progress },
  { path: '/base-circle-progress', title: '基础圆形进度条', component: CircleProgress },
  { path: '/base-gauge-progress', title: '基础仪表进度条', component: GaugeProgress },
  { path: '/base-range', title: '基础范围输入框', component: Range },
  { path: '/base-horizontal-timeline', title: '基础水平时间线', component: HorizontalTimeLine },
  { path: '/base-vertica-timeline', title: '基础垂直时间线', component: VerticalTimeLine },
  { path: '/base-horizontal-divider', title: '基础水平分割条', component: HorizontalDivider },
  { path: '/base-vertica-divider', title: '基础垂直分割条', component: VerticalDivider },
  { path: '/base-date-picker',title: '基础日期选择器', component: DatePicker },
  { path: '/base-time-picker', title: '基础时间选择器',component: TimePicker },
  { path: '/base-date-range-picker',title: '基础日期范围选择器', component: DateRangePicker },
  { path: '/base-date-time-picker',title: '基础日期时间选择器', component: DateTimePicker },
  { path: '/base-time-range-picker',title: '基础时间范围选择器', component: TimeRangePicker },
  { path: '/base-date-time-range-picker',title: '基础日期时间范围选择器', component: DateTimeRangePicker },
  { path: '/base-select',title: '基础选择器', component: Select },
  { path: '/base-month-picker',title: '基础月份选择器', component: MonthPicker },
  { path: '/base-week-picker', title: '基础周选择器', component: WeekPicker },
  { path: '/base-year-picker',title: '基础年选择器', component: YearPicker },
  { path: '/base-cascader',title: '基础级联选择器', component: Cascader },
  { path: '/base-radio-button', title: '基础单选按钮', component: RadioButton },
  { path: '/base-radio-button-group', title: '基础单选按钮组', component: RadioButtonGroup },
  { path: '/base-checkbox', title: '基础复选框', component: Checkbox },
  { path: '/base-checkbox-group', title: '基础复选框组', component: CheckboxGroup },
  { path: '/base-check-button', title: '基础复选按钮', component: CheckButton },
  { path: '/base-check-button-group', title: '基础复选按钮组', component: CheckButtonGroup },
  { path: '/base-list', title: '基础列表', component: List },
  { path: '/base-order-list', title: '基础有序列表', component: OrderList },
  { path: '/base-tag', title: '基础标签', component: Tag },
  { path: '/base-badge', title: '基础标记', component: Badge },
  { path: '/base-badge-tag', title: '基础标记标签', component: BadgeTag },
  { path: '/base-skeleton', title: '基础骨架屏', component: Skeleton },
  { path: '/base-empty', title: '基础空状态', component: Empty },
  { path: '/base-tree', title: '基础树', component: Tree },
  { path: '/base-card', title: '基础卡片', component: Card },
  { path: '/base-card-tree', title: '基础卡片树', component: CardTree },
  { path: '/base-editable-tree', title: '基础编辑树', component: EditableTree },
  { path: '/base-option-list', title: '基础选项列表', component: OptionList },
  { path: '/base-object-list', title: '基础对象列表', component: ObjectList },
  { path: '/base-editable-list', title: '基础可编辑列表', component: EditableList },
  { path: '/base-dropdown', title: '基础下拉菜单', component: Dropdown },
  { path: '/base-dropdown-item', title: '基础下拉菜单项', component: DropdownItem },
  { path: '/base-card-list', title: '基础卡片列表', component: CardList },
  { path: '/base-editable-card-list', title: '基础可编辑卡片列表', component: EditableCardList },
  { path: '/base-tree-chart', title: '基础树状图', component: TreeChart },
  { path: '/base-table', title: '基础表格', component: Table },
  { path: '/base-form', title: '基础表单', component: Form },
  { path: '/base-editable-table', title: '基础可编辑表格', component: EditableTable },
  { path: '/base-pie-chart', title: '基础饼图', component: PieChart },
  { path: '/feature-tag', title: '功能标签', component: FeatureTag },
  { path: '/feature-checkable-tag', title: '可选标签', component: CheckableTag },
  { path: '/feature-checkable-tag-group', title: '可选标签组', component: CheckableTagGroup },
  { path: '/feature-closable-tag', title: '可关闭标签', component: ClosableTag },
  { path: '/feature-editable-tag', title: '可编辑标签', component: EditableTag },
  { path: '/feature-descriptions', title: '对象描述', component: Descrptions },
  { path: '/feature-text-input', title: '功能文本输入框', component: FeatureTextInput },
  { path: '/feature-textarea', title: '功能文本域输入框', component: TextareaInput },
  { path: '/feature-password', title: '功能密码输入框', component: PasswordInput },
  { path: '/feature-input-number', title: '功能数值输入框', component: NumberInput },
  { path: '/feature-slider', title: '功能滑动选择器', component: FeatureSlider },
  { path: '/feature-range', title: '功能范围输入框', component: RangeInput },
  { path: '/feature-comment', title: '功能评论器', component: Comment },
  { path: '/feature-row', title: '栅格布局', component: Row },
  { path: '/feature-collapse', title: '折叠面板', component: CollapsePanel },
  { path: '/feature-calendar', title: '功能日历', component: Calendar },
  { path: '/feature-color-picker', title: '颜色选择器', component: ColorPicker },
  { path: '/feature-date-picker', title: '日期选择器', component: FeatureDatePicker },
  { path: '/feature-time-picker', title: '时间选择器', component: FeatureTimePicker },
  { path: '/feature-date-time-picker', title: '日期时间选择器', component: FeatureDateTimePicker },
  { path: '/feature-date-range-picker', title: '日期范围选择器', component: FeatureDateRangePicker },
  { path: '/feature-time-range-picker', title: '时间范围选择器', component: FeatureTimeRangePicker },
  { path: '/feature-month-picker', title: '月份选择器', component: FeatureMonthPicker },
  { path: '/feature-year-picker', title: '年份选择器', component: FeatureYearPicker },
  { path: '/feature-property-panel', title: '属性面板', component: PropertyPanel },
  { path: '/feature-property-setting', title: '属性设置面板', component: PropertySetting },
  { path: '/feature-edit-panel', title: '编辑面板', component: EditPanel },
  { path: '/feature-measure-input', title: '功能指标输入框', component: MeasureInput },
  { path: '/feature-switch', title: '功能开关', component: FeatureSwitch },
  { path: '/feature-radio', title: '功能单选框', component: FeatureRadio },
  { path: '/feature-radio-group', title: '功能单选组', component: FeatureRadioGroup },
  { path: '/feature-radio-button', title: '功能单选按钮', component: FeatureRadioButton },
  { path: '/feature-radio-button-group', title: '功能单选按钮组', component: FeatureRadioButtonGroup },
  { path: '/feature-checkbox', title: '功能复选框', component: FeatureCheckbox },
  { path: '/feature-check-button', title: '功能复选按钮', component: FeatureCheckButton },
  { path: '/feature-check-button-group', title: '功能复选按钮组', component: FeatureCheckButtonGroup },
  { path: '/feature-list', title: '功能列表', component: FeatureList },
  { path: '/feature-option-list', title: '功能选项列表', component: FeatureOptionList },
  { path: '/feature-container', title: '普通容器', component: Container },
  { path: '/feature-group-panel', title: '分组容器', component: GroupPanel },
  { path: '/feature-tabs', title: '标签页', component: Tabs },
  { path: '/feature-modal', title: '模态对话框', component: ModalDialog },
  { path: '/feature-drawer', title: '抽屉框', component: Drawer },
  { path: '/feature-popover', title: '气泡框', component: Popover },
  { path: '/feature-pop-confirm', title: '气泡确认框', component: PopConfirm },
  { path: '/feature-week-picker', title: '周选择器', component: FeatureWeekPicker },
  { path: '/feature-select', title: '选择器', component: FeatureSelect },
  { path: '/feature-cascader', title: '级联选择器', component: FeatureCascader },
  { path: '/feature-segmented', title: '分段选择器', component: Segmented },
  { path: '/feature-bread-crumb', title: '面板屑', component: Breadcrumb },
  { path: '/feature-steps', title: '步骤条', component: Steps },
  { path: '/feature-page-header', title: '页头', component: PageHeader },
  { path: '/feature-simple-pagination', title: '简单分页条', component: SimplePagination },
  { path: '/feature-pagination', title: '分页条', component: Pagination },
  { path: '/feature-back-top', title: '回到顶部', component: BackTop },
  { path: '/feature-affix', title: '固钉', component: Affix },
  { path: '/feature-anchor', title: '锚点', component: Anchor },
  { path: '/feature-option-transfer', title: '选项穿梭框', component: OptionTransfer },
  { path: '/feature-list-transfer', title: '选项穿梭框', component: ListTransfer },
  { path: '/feature-table-transfer', title: '表格穿梭框', component: TableTransfer },
  { path: '/feature-tree-transfer', title: '树穿梭框', component: TreeTransfer },
  { path: '/feature-tooltip', title: '文字提示框', component: Tooltip },
  { path: '/feature-alert', title: '警告提示框', component: Alert },
  { path: '/feature-message', title: '全局提示', component: Message },
  { path: '/feature-notification', title: '通知提醒框', component: Notification },
  { path: '/feature-result', title: '结果', component: Result },
  { path: '/feature-loading', title: '加载中', component: Loading },
  { path: '/feature-table', title: '功能表格', component: FeatureTable },
  { path: '/feature-editable-table', title: '可编辑表格', component: FeatureEditableTable },
  { path: '/feature-statistic', title: '统计', component: Statistic },
  { path: '/feature-second-countdown', title: '读秒倒计时', component: SecondCountdown },
  { path: '/feature-minute-countdown', title: '分钟倒计时', component: MinuteCountdown },
  { path: '/feature-millisecond-countdown', title: '毫秒倒计时', component: MillisecondCountdown },
];

/**
 * @description: 从arr中提取包含str项
 * @param {string} str
 * @param {Array} arr
 */
function filterFromStr(str, arr) {
  return arr.filter(item => item.path && item.path.includes(str))
}

const formatTitle = (title, str) => title.slice(1 + str.length).replace(/-([a-z])/g, (p, m) => m.toUpperCase());

// 从routes中提取menu菜单信息

function formatMenu(str, arr) {
  return filterFromStr(str, arr).map(({path, title, }) => ({
    path,
    title,
    label: formatTitle(path, str)
  }))
}

export const menuRoute = [
  { title: 'base', children: formatMenu('base', routes) },
  { title: 'feature', children: formatMenu('feature', routes) },
  { title: 'others', children: formatMenu('others', routes) }
]

export default routes;
